/**
 * Copyright (C) 2009-2012, KingHool.com
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see http://www.gnu.org/licenses.
 */
package com.kinghool.smodel;


import com.kinghool.ebos.commons.vo.IPropertyHolder;
import com.kinghool.smodel.def.ModelDefinition;

/**
 * 
 * @Author Allen Deng(dengtailin@gmail.com) 
 */
public interface IModel extends IPropertyHolder {
	/**
	 * get the model identifier of the model
	 */
	public String getModelId();
	
	/**
	 * set model identifier of the model
	 */
	public void setModelId(String modelId);
	
	/**
	 * check all the properties of the model class if meets the validation rules
	 */
	public boolean isValid();  
	
	/**
	 * reset model
	 */
	public void reset();
	
	/**
	 * validate the model
	 * @return the validation result of the model
	 */
	public ValidationResult validate();
	 
	/**
	 * validate the model with the given ModelDefinition
	 * @return the validation result of the model
	 */
	public ValidationResult validate(ModelDefinition modelDefinition);
	
	/**
	 * check whether the given propertyName is unseted
	 */
	public boolean isUnset(String propertyName);
	
	/**
	 * get the default value of the given property.
	 */
	public Object getDefaultValue(String propertyName);
	
	/**
	 * get the definition model of the model
	 */
	public ModelDefinition getModelDefinition();
	
	/**
	 * clone
	 */
	public IModel clone() throws CloneNotSupportedException;
}
